<template>
		<view class="per_list">
			<view class="per_one" @click="toSavePinia(patientItem)" v-for="patientItem in patientList">
				<view class="per_name">
					<view style="margin-right: 20px;">{{patientItem.name}}</view><up-tag :text="patientItem.relation" size="mini" plain  type="primary"></up-tag>
				</view>
				<view class="per_info"> 
					<view style="margin-right: 20px;">{{patientItem.sex}}</view><view style="margin-right: 20px;">{{patientItem.age}}</view><view>{{patientItem.phone}}</view>
				</view>
			</view>
		</view>
</template>

<script lang="ts" setup>
	 import {getPatient} from '@/api/user.js'
	 import {painStore} from '@/store/painer.js'
	 import {ref} from 'vue'
	 let pStore=painStore(); //获取Pinia的操作实例
	 let patientList=ref([])
	
	 let getPlist=async ()=>{
		 let res=await getPatient()
		 console.log(res,"就诊人")
		  patientList.value=res.data;
	 }
	 getPlist();
	 
	 // 点击就诊人 存储就诊人到pinia
	 let toSavePinia=(patientItem)=>{
		 pStore.changePain(patientItem)
		 uni.navigateBack()//返回上一个操作
	 }
	 
</script>


<style lang="scss">
	.per_one{
		width: 100vw;
		height: 200rpx;
		border-bottom:1px solid black ;
		background: skyblue;
		margin-top: 20px;
		display: flex;
		justify-content: space-evenly;
		flex-direction: column;
		padding:0 30px;
		box-sizing: border-box;
		.per_name{
			display: flex;
		}
		.per_info{
			display: flex;
			
		}
		
	}
</style>